package com.lan.support.boot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.PropertiesPropertySource;

import java.util.Properties;


public class CustomEnvironmentConfig implements EnvironmentPostProcessor {

    static Logger log = LoggerFactory.getLogger(CustomEnvironmentConfig.class);


    @Override
    public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {

        Properties properties = new Properties();
        properties.put("spring.mvc.dateFormat", "yyyy-MM-dd HH:mm:ss");

//        log.debug("ConfListener" + JSON.toJSONString(properties));
        PropertiesPropertySource pps = new PropertiesPropertySource("my", properties);
        environment.getPropertySources().addFirst(pps);

    }

}
